package com.ruoyi;

import com.ruoyi.common.config.MqttConnect;
import com.ruoyi.common.service.MqttServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

import javax.annotation.PostConstruct;

/**
 * 启动程序
 *
 * @author ruoyi
 */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class RuoYiApplication {
    public static void main(String[] args) {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(RuoYiApplication.class, args);
        System.out.println("(♥◠‿◠)ﾉﾞ  启动成功   ლ(´ڡ`ლ)ﾞ ");
    }

    @Autowired
    private MqttServer mqttServer;

    @PostConstruct
    public void init(){
        try {
            mqttServer.connectClient();
        }catch (Exception e){
            throw new RuntimeException("连接mqtt异常");
        }
    }
}